//
//  HMMainViewController.swift
//  HMWB21Pre
//
//  Created by Faner on 16/10/8.
//  Copyright © 2016年 --. All rights reserved.
//

import UIKit

class HMMainViewController: UITabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        
        addChildViewController(childController: HMHomeViewController(), title: "首页", imgName: "tabbar_home")
        addChildViewController(childController: HMMessageViewController(), title: "消息", imgName: "tabbar_message_center")
        addChildViewController(childController: HMHomeViewController(), title: "发现", imgName: "tabbar_discover")
        addChildViewController(childController: HMHomeViewController(), title: "我", imgName: "tabbar_profile")
        
        
    }
    
    
    private func addChildViewController(childController: UIViewController,title: String, imgName: String){
        
        childController.title = title
        
        childController.tabBarItem.image = UIImage(named: imgName)
        childController.tabBarItem.selectedImage = UIImage(named: "\(imgName)_selected")?.withRenderingMode(UIImageRenderingMode.alwaysOriginal)
        
        childController.tabBarItem.setTitleTextAttributes([NSForegroundColorAttributeName: UIColor.orange], for: UIControlState.selected)
        
        addChildViewController(UINavigationController(rootViewController: childController))
        
    }
    
    

}
